<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>试卷管理</title>
    <script src="/static/exam/layui/layui.js"></script>
    <script src="/static/exam/js/jquery.js"></script>
    <link rel="stylesheet" href="/static/exam/layui/css/layui.css" media="all">
    <style type="text/css">
        html,body{
            width: 100%;
            height: 100%;
            margin: 0;
        }
    </style>
    <script>
        $(function () {
            $.get('{:url("exam/common/check")}',function(data){
                if(data == '0'){
                    alert("请先登录！")
                    top.location.href='{:url("exam/login/homeLogin")}'
                }
            },"json")
        })
    </script>
</head>
<body>
<div style="margin-right: 15px">
    <!-- 内容主体区域 -->
    <div>
        当前位置：
        <span class="layui-breadcrumb" lay-separator=" > " style="visibility: visible;">
            <a href="">首页 > </a>
            <a><cite>试卷记录</cite></a>
        </span>
    </div>
    <div>

        <div style="clear:both;">
            <table class="layui-hide" id="test" lay-filter="test"></table>
        </div>
    </div>

</div>



<div class="layui-layer-shade" id="layui-layer-shade1" times="1" style="z-index: 999;display: none; background-color: rgb(0, 0, 0); opacity: 0.3;"></div>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-xs " lay-event="look">试卷详情</a>
</script>
<script>

    function insToggle() {
        $("#insert").fadeToggle("slow")
        $("#layui-layer-shade1").fadeToggle()
    }

    function updToggle() {
        $("#update").fadeToggle("slow")
        $("#layui-layer-shade1").fadeToggle()
    }
    layui.use('table', function () {
        var table = layui.table;

        table.render({
            elem: '#test'
            , url: '{:url("exam/paper/upaperlist")}'
            , title: '试卷记录表'
            , cols: [[
                {field: 'id', title: '序号', width: 100,type:'numbers'}
                , {field: 'pname', title: '试卷名', width: 200}
                , {field: 'subject', title: '科目', width: 200}
                ,{field: 'ctime', title: '答题时间', width: 200}
                ,{field: 'score', title: '分数', width: 200}
                , {fixed: 'right', title: '操作', toolbar: '#barDemo'}
            ]]
            ,page: true
            ,limit:6,
            cellMinWidth: 30
        });

        //监听行工具事件
        table.on('tool(test)', function (obj) {
            var data = obj.data;
            //console.log(obj)
            // if (obj.event === 'del') {
            //     layer.confirm('您确定要删除该试卷信息吗？', function (index) {
            //         $.get('{:url("exam/paper/deletesp")}', {'id': data.id}, function (result) {
            //             if (result > 0) {
            //                 alert("删除成功！");
            //             }else{
            //                 alert("删除失败！");
            //             }
            //             location.reload(true)
            //         })
            //     });
            // }else
             if (obj.event === 'look'){
                window.location.href='{:url("exam/paper/detailsp")}?id='+data.id
            }
        });
    });



</script>
</body>
</html>